//
//  tableListViewController.m
//  ASNews
//
//  Created by Aska Chak on 8/24/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "tableListViewController.h"
#import "tableListCell.h"

@implementation tableListViewController
@synthesize tableView = _tableView;

static NSString *CellIdentifier = @"tableListCell";

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    }
    return self;
}


-(void) dealloc 
{
    [_tableView release];
    [super dealloc];
}

//for table
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    return 120;
} 


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    tableListCell *cell = (tableListCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (!cell)
    {
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:CellIdentifier owner:nil options:nil];
        for(id currentObject in topLevelObjects)
        {
            if([currentObject isKindOfClass:[tableListCell class]])
            {
                cell = (tableListCell *)currentObject;
                break;
            }
        }
    }
    
    [cell setTitleWithString:@"Yellow taxis receive 18-month contract" WithContain:@"The yellow taxi company contract will be renewed for \“one year or 18 months\” while negotiations for a long-term contract are underway, Transport Bureau (DSAT) director Wong Wan said yesterday."];
    
    return cell;
}

@end
